home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994…tember: Reference Library / Dev.CD Sep 94.toast / Periodicals / develop / develop Issue 19 / develop 19 code / GX Bitmaps / DrawShapeOffscreen.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-07-21  |  986 b   |  47 lines  |  [TEXT/KAHL]

  1. /*
  2. ••••••••••••••••••••
  3.     DrawShapeOffscreen.c
  4.     David Surovell
  5.  
  6.     this file contains 1 routine that demonstrates drawing a shape into a gx offscreen
  7.     (a qdgx library structure) for a single, one-shot instance.
  8. ••••••••••••••••••••
  9. */
  10.  
  11. #include <Types.h>
  12.  
  13. #include "graphics types.h"
  14. #include "graphics errors.h"
  15. #include "graphics routines.h"
  16.  
  17. #include "offscreen library.h"
  18.  
  19.  
  20. void DrawShapeOffscreen(
  21.     offscreen    *offGXWorld,
  22.     gxShape    targetShape );
  23.  
  24.  
  25. void DrawShapeOffscreen(
  26.     offscreen    *offGXWorld,
  27.     gxShape    targetShape )
  28. {
  29. gxTransform    newXform, savedXform;
  30.  
  31.     if ((offGXWorld == nil) || (targetShape == nil))
  32.         return;
  33.     if (offGXWorld->port == nil)
  34.         return;
  35.  
  36.     savedXform = GXGetShapeTransform( targetShape );
  37.     newXform = GXCopyToTransform( nil, savedXform );
  38.     GXSetTransformViewPorts( newXform, 1L, &(offGXWorld->port) );
  39.     GXSetShapeTransform( targetShape, newXform );
  40.  
  41.     GXDrawShape( targetShape );
  42.  
  43.     GXSetShapeTransform( targetShape, savedXform );
  44.     GXDisposeTransform( newXform );
  45. }
  46.  
  47.